import { legacy_createStore, combineReducers, applyMiddleware, compose } from
  "redux"; //rt
import reduxThunk from 'redux-thunk' //rt

import handleNum from './Num/reducer'
const reducers = combineReducers({
  handleNum
})


// window.__REDUX_DEVTOOLS_EXTENSION__ &&window.__REDUX_DEVTOOLS_EXTENSION__() 是为了让浏览器正常使用redux-devtools
// const store = legacy_createStore(reducers, window.__REDUX_DEVTOOLS_EXTENSION__ &&
//   window.__REDUX_DEVTOOLS_EXTENSION__());

// 上面的store是不用异步react的store；下面的composeEnhancers给store，就可以在组件中使用异步的调用actions中的方法
let composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ?
  window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}) : compose //rt
// 把仓库数据，浏览器redux-dev-tools，还有reduxThunk插件关联在store中
const store =
  legacy_createStore(reducers, composeEnhancers(applyMiddleware(reduxThunk))); //rt

export default store